import { StyleSheet, Text, View, DeviceEventEmitter, Pressable } from 'react-native';
import React from 'react';
import Icon from 'react-native-vector-icons/Ionicons';
import { useNavigation, useRoute } from '@react-navigation/native';
import WebView from 'react-native-webview';
import { useTranslation } from 'react-i18next';
import { px2dp, width } from '~/utils/px2dp';
import { NavBarHeader } from '~/components';

export default function PrivacyScreen() {
    const { t } = useTranslation();
    const navigate = useNavigation();
    const route = useRoute<any>();
    const { type, currentPage = '' } = route.params || {};
    const goBack = () => {
        if (currentPage == 'AgreementModal') {
            DeviceEventEmitter.emit('AgreementModal');
        }
        navigate.goBack();
    };
    return (
        <View style={styles.container}>
            <NavBarHeader
                title={t('PrivacyScreen.title')}
                leftComponent={
                    <Pressable onPress={goBack}>
                        <Icon name="chevron-back-outline" size={px2dp(50)} color={'#000'}></Icon>
                    </Pressable>
                }
            />
            <WebView
                source={{ uri: 'https://line.shbjy.cn/wxdata/privacyUK.html' }}
                style={{ flex: 1 }}
                startInLoadingState={true}
            />
        </View>
    );
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#F6F7F9',
    },
});
